package com.ccrego.haiyi.common.http;

import android.content.Context;

import com.ccrego.haiyi.BuildConfig;
import com.pachong.android.framework.httprequest.UrlParams;
import com.pachong.android.frameworkbase.utils.DeviceInfoUtil;

/**
 * url base
 *
 * @Author: PV
 * @E-mail: pengveivei@sina.cn
 * @CreateDate: 2016/7/18 14:56
 * @Version: 1.0.0
 */
public class UrlBase {
    /**
     * URL 前缀
     * e.g http://192.168.1.158:876
     */
    public final static String URL_PREFIX;

    // region url 前缀初始化
    static {
        if (BuildConfig.DEBUG || BuildConfig.BUILD_TYPE.equals("alpha") || BuildConfig.BUILD_TYPE.equals("beta")) {
            // 开发环境的url配置
            URL_PREFIX = "http://server.haiyi.xmappservice.com";
//            URL_PREFIX = "http://server.ccrego.com:8081";

        } else {
            // 正式环境的url配置
            URL_PREFIX = "http://server.ccrego.com:8081"; // TODO
        }
    }
    // endregion

    private static UrlParams getBaseParams(Context context) {
        UrlParams params = new UrlParams();
        // User info
        params.put(ParamKey.IMSI, DeviceInfoUtil.getImsi(context));
        params.put(ParamKey.IMEI, DeviceInfoUtil.getImei(context));
        return params;
    }


    public static class ParamKey {
        public static final String IMSI = "imsi";
        public static final String IMEI = "imei";
    }

}
